﻿using System;
using System.Collections.Generic;
#if DEBUG
using System.Diagnostics;
#endif // #if DEBUG
using System.Net;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using FRL.DebtChased.Repository;

namespace FRL.DebtChased.Silverlight.Library
{

	/// <summary>
	/// Declaration of MessageBoxes class
	/// </summary>
	public static class MessageBoxes
	{

		/////////////////////////////////////////////////////////////
		// Static Operations

		public static void PopupMessage(string strMsg)
		{

			// Show popup message
			MessageBox.Show(strMsg, "Chasing Workspace", MessageBoxButton.OK);

		}

		public static bool PopupOption(string strMsg)
		{

			// Show popup option
			return (MessageBox.Show(strMsg, "Chasing Workspace", MessageBoxButton.OKCancel) == MessageBoxResult.OK);

		}

		public static void PopupDevMessage()
		{

			// Call sibling function
			PopupMessage("This function is currently under development.");

		}

		public static void PopupMessage_InternalError(string strError)
		{

			// Call sibling function
			PopupMessage(
				string.Format("{0}  {1}",Definitions.InternalError,strError)
			);

		}

		public static void PopupErrors(List<string> Errors)
		{
#if DEBUG
			Debug.Assert(Errors != null);
			Debug.Assert(Errors.Count > 0);
#endif // #if DEBUG

			// Message for user and exit
			StringBuilder sb = new StringBuilder();
			sb.Append("Please correct the following:\n\n");
			foreach (string strError in Errors)
				sb.AppendFormat("{0}\r\n", strError);
			MessageBoxes.PopupMessage(sb.ToString());

		}

	}

}
